#include "xtypes.h"
#include "util_point.h"


point3_t xGenPoint3(const point4_t pt4)
{
	point3_t pt3;
	pt3.x = pt4.x/pt4.w;
	pt3.y = pt4.y/pt4.w;
	pt3.z = pt4.z/pt4.w;
	return pt3;
}

point3_t xGenPoint3(float_t x, float_t y, float_t z)
{
	point3_t pt3;
	pt3.x = x;
	pt3.y = y;
	pt3.z = z;

	return pt3;
}


point4_t xGenPoint4(const point3_t pt3)
{
	point4_t pt4;
	pt4.x = pt3.x;
	pt4.y = pt3.y;
	pt4.z = pt3.z;
	pt4.w = 1.0;

	return pt4;
}

point4_t xGenPoint4(float_t x, float_t y, float_t z, float_t w)
{
	point4_t pt4;
	pt4.x = x;
	pt4.y = y;
	pt4.z = z;
	pt4.w = w;

	return pt4;
}



vector3_t xGenVector3(float_t x, float_t y, float_t z)
{
	vector3_t t;
	t.x = x;
	t.y = y;
	t.z = z;
	return t;
}



point4_t operator*(point4_t p4d, matrix4x4_t m44)
{
	return xPt4MulMat4x4(p4d, m44);
}


point4_t& operator*=(point4_t& p4d, matrix4x4_t m44)
{
	p4d = xPt4MulMat4x4(p4d, m44);
	return p4d;
}

